<template>
	<view class="content">
		<!-- status -->
		<view class="status"></view>
		<!-- 头部 -->
		<view class="detail-nav">
			<text class="nav-icon cuIcon-back" @tap="goBack()"></text>
			<view class="detail-name">
				{{movieName}}
			</view>
		</view>
		<!-- 播放图 -->
		<view class="detail-player">
			<view 
			class="player"
			:style="'background-image: url('+ movieImg +');'"
			style="background-repeat: no-repeat;background-size: 100% 100%;">
				<text class="player-icon cuIcon-playfill" @tap="goPlayer(movieName, current_play_href)"></text>
			</view>
		</view>
		<!-- 电影详情 -->
		<view class="movie-detail">
			<view class="movie-name">
				{{movieName}}
			</view>
			<text class="movie-detail-icon" :class="ifShowMsg?'cuIcon-fold':'cuIcon-unfold'" @tap="showMsg()"></text>
		</view>
		<view class="detail-msg" v-show="ifShowMsg">
			<view class="movie-actor">
				主演: 暂无
			</view>
			<view class="movie-msg">
				电影详情: 暂无
			</view>
		</view>
		<!-- 选择播放源 -->
		<view class="source-title">
			如果播放失败请更换播放源
			<view class="current-source">
				当前播放源:&nbsp;{{selected_source + 1}}
			</view>
		</view>
		<view class="play-source">
			<view class="source" :class="selected_source==0?'selected':''" @tap="changeSource(0)">
				1
			</view>
			<view class="source" :class="selected_source==1?'selected':''" @tap="changeSource(1)">
				2
			</view>
			<view class="source" :class="selected_source==2?'selected':''" @tap="changeSource(2)">
				3
			</view>
			<view class="source" :class="selected_source==3?'selected':''" @tap="changeSource(3)">
				4
			</view>
			<view class="source" :class="selected_source==4?'selected':''" @tap="changeSource(4)">
				5
			</view>
		</view>
		<!-- 选集 -->
		<view class="source-title">
			选集
		</view>
		<view class="movie-list">
			<view class="list selected" >
				1
			</view>
			<view class="list">
				2
			</view>
			<view class="list">
				3
			</view>
			<view class="list">
				4
			</view>
			<view class="list">
				11
			</view>
			<view class="list">
				89
			</view>
			<view class="list">
				111
			</view>
		</view>
		<!-- 评论 -->
		<view class="comment">
			评论
		</view>
		<view class="comment-list">
			<view class="comments">
				太好看了吧!!!
			</view>
			<view class="comments">
				太好看了吧!!!
			</view>
			<view class="comments">
				太好看了吧!!!
			</view>
		</view>
		<view class="last">
			没有更多啦&nbsp;~
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				sourceList: [
					'https://api.spjx.live/?url=',
					'https://api.spjx.site/?url=',
					'https://api.vipjx.live/?url=',
					'https://api.vipjx.site/?url=',
					'https://api.vipjx.xyz/?url='
				],
				current_play_href: '',
				movieName:'',
				movieImg: '',
				movieHref: '',
				ifShowMsg: false,
				selected_source: 0,
			}
		},
		onLoad(opt) {
			uni.showLoading({
				title: '加载数据中'
			})
			this.movieName = opt.title;
			this.movieImg = opt.img;
			this.movieHref = opt.href;
			this.current_play_href = this.sourceList[0]+this.movieHref;
			uni.hideLoading();
		},
		methods: {
			goBack(){
				history.back();
			},
			showMsg(){
				this.ifShowMsg = !this.ifShowMsg;
			},
			changeSource(id){
				this.selected_source = id;
				this.current_play_href = this.sourceList[id]+this.movieHref;
				//console.log(this.current_play_href)
			},
			goPlayer(title, href){
				uni.navigateTo({
					url: '../player/player?title='+ title +'&href='+ href
				})
			}
		}
	}
</script>

<style>
	@import url("./index.css");
</style>
